package com.hyd.manage.service.impl;

import java.util.List;
import com.hyd.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hyd.manage.mapper.StockAlertMapper;
import com.hyd.manage.domain.StockAlert;
import com.hyd.manage.service.IStockAlertService;

/**
 * 药品库存预警Service业务层处理
 * 
 * @author hwb
 * @date 2025-02-24
 */
@Service
public class StockAlertServiceImpl implements IStockAlertService 
{
    @Autowired
    private StockAlertMapper stockAlertMapper;

    /**
     * 查询药品库存预警
     * 
     * @param id 药品库存预警主键
     * @return 药品库存预警
     */
    @Override
    public StockAlert selectStockAlertById(Long id)
    {
        return stockAlertMapper.selectStockAlertById(id);
    }

    /**
     * 查询药品库存预警列表
     * 
     * @param stockAlert 药品库存预警
     * @return 药品库存预警
     */
    @Override
    public List<StockAlert> selectStockAlertList(StockAlert stockAlert)
    {
        return stockAlertMapper.selectStockAlertList(stockAlert);
    }

    /**
     * 新增药品库存预警
     * 
     * @param stockAlert 药品库存预警
     * @return 结果
     */
    @Override
    public int insertStockAlert(StockAlert stockAlert)
    {
        stockAlert.setCreateTime(DateUtils.getNowDate());
        return stockAlertMapper.insertStockAlert(stockAlert);
    }

    /**
     * 修改药品库存预警
     * 
     * @param stockAlert 药品库存预警
     * @return 结果
     */
    @Override
    public int updateStockAlert(StockAlert stockAlert)
    {
        stockAlert.setUpdateTime(DateUtils.getNowDate());
        return stockAlertMapper.updateStockAlert(stockAlert);
    }

    /**
     * 批量删除药品库存预警
     * 
     * @param ids 需要删除的药品库存预警主键
     * @return 结果
     */
    @Override
    public int deleteStockAlertByIds(Long[] ids)
    {
        return stockAlertMapper.deleteStockAlertByIds(ids);
    }

    /**
     * 删除药品库存预警信息
     * 
     * @param id 药品库存预警主键
     * @return 结果
     */
    @Override
    public int deleteStockAlertById(Long id)
    {
        return stockAlertMapper.deleteStockAlertById(id);
    }
}
